package converter;

import java.util.Map;

import org.apache.struts2.util.StrutsTypeConverter;

public class AgeConverter extends StrutsTypeConverter {

	@Override
	public Object convertFromString(Map arg0, String[] arg1, Class arg2) {
		try {
			int age=Integer.parseInt(arg1[0]);
			return age;
		} catch (Exception e) {
			e.printStackTrace();
			return 0;
		}
		
	}

	@Override
	public String convertToString(Map arg0, Object arg1) {
		if(arg1 instanceof Integer)
		{
			return arg0.toString();
		}
		return null;
	}

}
